package com.yxj04;

import java.util.HashMap;
import java.util.Set;

public class HashMapDemo {
    public static void main(String[] args) {
        HashMap<Student,String> hm = new HashMap<Student,String>();
        Student s1 = new Student("林青霞",34);
        Student s2 = new Student("张玉",30);
        Student s3 = new Student("猪八戒", 23);
        Student s4 = new Student("猪八戒", 23);
        hm.put(s1,"武汉");
        hm.put(s2,"景德镇");
        hm.put(s3,"长沙");
        hm.put(s4,"重庆");
        Set<Student> keySet = hm.keySet();
        for(Student key : keySet) {
            String value = hm.get(key);
            System.out.println(key.getName()+","+key.getAge()+","+value);
        }
    }
}
